package com.nidu.demo.company;

import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.nidu.demo.company.dto.CompanyAddCmd;
import com.nidu.demo.company.dto.CompanyListQry;
import com.nidu.demo.company.dto.CompanyPageQry;
import com.nidu.demo.company.dto.CompanyUpdateCmd;
import com.nidu.demo.common.enums.StatusEnum;
import com.nidu.demo.company.api.SysCompanyService;
import com.nidu.demo.company.dto.*;
import com.nidu.demo.company.executor.command.*;
import com.nidu.demo.company.executor.query.*;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.Set;

/**
 * 公司服务实现类
 *
 * @author auto
 */
@Service
@RequiredArgsConstructor
public class SysCompanyServiceImpl implements SysCompanyService {

    private final CompanyAddCmdExe addCmdExe;
    private final CompanyUpdateCmdExe updateCmdExe;
    private final CompanyDeleteCmdExe deleteCmdExe;
    private final CompanySingleQryExe singleQryExe;
    private final CompanyListQryExe listQryExe;
    private final CompanyPageQryExe pageQryExe;

    @Override
    public SingleResponse<CompanyCO> add(CompanyAddCmd cmd) {
        return addCmdExe.execute(cmd);
    }

    @Override
    public SingleResponse<CompanyCO> update(CompanyUpdateCmd cmd) {
        return updateCmdExe.execute(cmd);
    }

    @Override
    public Response delete(Long id) {
        return deleteCmdExe.execute(id);
    }

    @Override
    public Response delete(Set<Long> ids) {
        return deleteCmdExe.execute(ids);
    }

    @Override
    public SingleResponse<CompanyCO> getById(Long id) {
        return singleQryExe.execute(id);
    }

    @Override
    public MultiResponse<CompanyCO> list(CompanyListQry qry) {
        return listQryExe.execute(qry);
    }

    @Override
    public PageResponse<CompanyCO> page(CompanyPageQry qry) {
        return pageQryExe.execute(qry);
    }

    @Override
    public Response updateStatus(Long id, StatusEnum status) {
        return updateCmdExe.updateStatus(id, status);
    }
} 